package pe.com.bbva.pct.dao;

import java.util.List;
import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

public interface GeneralDAO<T> {
	
	@PersistenceContext
	public abstract void setEntityManager(EntityManager em);

	public abstract void insertarObjeto(T t) throws Exception;
	
	public abstract T actualizarObjeto(T t) throws Exception;

	public abstract void borrarObjeto(T t) throws Exception;

	public abstract T obtenerObjeto(Object id, Class<T> type) throws Exception;
	
	public abstract Object findObjectByNamedQuery(String queryName,Map<String, Object> parameters) throws Exception;

	public abstract Object findObjectByNamedQuery(String queryName,Map<String, Object> parameters, int resultLimit) throws Exception;

	public abstract List<T> findByNamedQuery(String queryName) throws Exception;

	public abstract List<T> findByNamedQuery(String queryName,int resultLimit) throws Exception;

	public abstract List<T> findByNamedQuery(String queryName,Map<String, Object> parameters) throws Exception;

	public abstract List<T> findByNamedQuery(String queryName,Map<String, Object> parameters, int resultLimit) throws Exception;

	public abstract List<Object> findByNativeQuery(String nativeQuery,Map<String, Object> parameters) throws Exception;

	public abstract List<Object> findByNativeQuery(String nativeQuery,Map<String, Object> parameters, int resultLimit) throws Exception;

	public abstract Object findObjectByNativeQuery(String nativeQuery,Map<String, Object> parameters, int resultLimit)throws Exception;

	public abstract void executeQueryNative(String sql, Map<String, Object> map)throws Exception;	
	
	public abstract List<Object> executeQueryNativeList(String sql,Map<String, Object> map)throws Exception;

	public T insertarObjetoReturnId(T t)throws Exception;
		
}
